﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TimedAttackBuff : TimedBuff
{
    private readonly PlayerComponent _PlayerComponent;

    private float _baseAttack = 50;
    private float _attackDelta;

    public TimedAttackBuff(ScriptableBuff buff, GameObject obj) : base(buff, obj)
    {
        _PlayerComponent = obj.GetComponent<PlayerComponent>(); 
    }

    protected override void ApplyEffect()
    {
        ScriptableAttackBuff AttackBuff = (ScriptableAttackBuff)Buff;
        _attackDelta = _baseAttack * AttackBuff.AttackIncrease;
        _PlayerComponent.Attack += _attackDelta;
    }

    public override void End()
    {
        _PlayerComponent.Attack -= _attackDelta * EffectStacks;
        EffectStacks = 0;
    }
}
